//------------Sonic CD Flower Script-------------//
//--------Scripted by Christian Whitehead 'The Taxman'--------//
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//

//-------Aliases-------//
#alias 45: TYPE_FLOWER


sub ObjectMain
	switch Object.State
	case 0
		Object.Frame=8
		Object.Value0++
		if Object.Value0==20
			Object.Value0=0
			Object.State++
		endif
		break
	case 1
		Object.Frame=Object.Value0
		Object.Frame>>=2
		Object.Value0++
		Object.Value0&=7
		Object.YPos+=131072
		ObjectTileCollision(0,0,8,0)
		if CheckResult==1
			Object.YPos+=524288
			Object.State++
			Object.Value0=0
			Object.Frame=2
		endif
		break
	case 2
		Object.Value0++
		if Object.Value0==4
			Object.Value0=0
			Object.State++
			Object.Frame=3
		endif
		break
	case 3
		Object.Value0++
		if Object.Value0==4
			Object.Value0=0
			Object.State++
			Object.Frame=2
		endif
		break
	case 4
		Object.Value0++
		if Object.Value0==4
			Object.Value0=0
			Object.State++
			Object.Frame=3
		endif
		break
	case 5
		Object.Value0++
		if Object.Value0==5
			Object.Value0=0
			Object.State++
			Object.Frame=4
		endif
		break
	case 6
		Object.Value0++
		if Object.Value0==4
			Object.Value0=0
			Object.State++
			Object.Frame=5
		endif
		break
	case 7
		Object.Value0++
		if Object.Value0==2
			Object.Value0=0
			Object.State++
			Object.Frame=6
		endif
		break
	case 8
		Object.Value0++
		if Object.Value0==20
			Object.Value0=0
			Object.State++
			Object.Frame=7
		endif
		break
	case 9
		Object.Value0++
		if Object.Value0==20
			Object.Value0=0
			Object.State--
			Object.Frame=6
		endif
		break

	endswitch
endsub


sub ObjectDraw
	DrawSprite(Object.Frame)
endsub


sub ObjectStartup
	LoadSpriteSheet("R1/Objects2.gif")
	SpriteFrame(-4,-8,8,16,180,1)
	SpriteFrame(-4,-8,8,16,180,18)
	SpriteFrame(-8,-16,16,16,26,229)
	SpriteFrame(-8,-16,16,16,43,229)
	SpriteFrame(-8,-16,16,16,60,229)
	SpriteFrame(-12,-24,24,24,165,90)
	SpriteFrame(-12,-48,24,48,165,66)
	SpriteFrame(-12,-48,24,48,165,115)
	SpriteFrame(0,0,0,0,0,0)
endsub

sub RSDK
	LoadSpriteSheet("Global/Display.gif")
	SetEditorIcon(Icon0,SingleIcon,-16,-16,32,32,1,143)
endsub
